package jssia.config.yaml;

import java.awt.geom.IllegalPathStateException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

public enum YamlLoaders {
    DATABASE ("conf/databases.yml"),
    JSSIA ("conf/jssia.yml");

    private final String filePath;

    private YamlLoaders(String filePath) {
        this.filePath = filePath;
    }

    public String getFilePath() {
        return filePath;
    }

    InputStream getFileInputStream() {
        InputStream input = null;
        try {
            input = new FileInputStream(new File(filePath));
        } catch (FileNotFoundException e) {
            throw new IllegalPathStateException("Could not locate file " + filePath + ".  Please add the configuration file and re-run.");
        }

        return input;
    }
}
